Component({

	properties: {
		title: {
			type: String,
			value: '自定义导航栏标题'
		},
		isTop: {
			type: Boolean,
			value: true
		}
	},

	lifetimes: {
		attached() {
			this.setNavigationBar()
		}
	},

	methods: {
		setNavigationBar() {
			const menuButtonInfo = wx.getMenuButtonBoundingClientRect()
			const systemInfo = wx.getSystemInfoSync()
			const navBarHeight = (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 + menuButtonInfo.height + systemInfo.statusBarHeight
			this.setData({
				navBarHeight,
				navMarginTop: menuButtonInfo.top
			})
            // 导航栏高度
            this.triggerEvent('top', menuButtonInfo.bottom + menuButtonInfo.top - systemInfo.statusBarHeight)
		},

		onBack() {
			wx.navigateBack()
		}
	}

})
